package com.triones.framework.common.rule;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * 得到表达式是否为真
 *
 * @author triones
 */
@Data
@NoArgsConstructor
public class BooleanRuleExprValue implements Comparable<BooleanRuleExprValue> {
    /**
     * 表达式
     */
    private String expr;

    /**
     * 执行顺序排序
     */
    private Integer sort;

    /**
     * 打印信息
     */
    private String print;

    /**
     * 表达式
     */
    private Map params;

    /**
     * 结果
     */
    private Boolean result;

    public BooleanRuleExprValue(String expr, Integer sort, Map params, String print) {
        this.expr = expr;
        this.sort = sort;
        this.params = params;
        this.print = print;
    }

    @Override
    public int compareTo(BooleanRuleExprValue sort) {
        return Integer.compare(getSort(), sort.getSort());
    }
}
